'use strict';

function numToChar(num) {
  let remainder = num%26;
  let quotient = parseInt(num/26);

  if(quotient === 0){
    return String.fromCharCode(remainder+96)
  }

  else if(quotient ===1&&remainder===0){
    return 'z';
  }

  else if(quotient > 1&&remainder===0){
    return numToChar(quotient-1) + 'z';
  }else {
    return numToChar(quotient) + String.fromCharCode(remainder+96);
  }
}
function average_to_letter(collection) {
  let result = [];
  let a = collection.reduce(function(previous,current){
    return previous+current;
  })
  let aver =Math.ceil(a/collection.length);
  result.push(numToChar(aver));
  console.log(result);
  return result;
  //在这里写入代码
}
average_to_letter([1,2,3,4,5,6,7,8,9,10]);
module.exports = average_to_letter;

